1: | even(0) | → true | |
2: | even(s(0)) | → false | |
3: | even(s(s(x))) | → even(x) | |
4: | half(0) | → 0 | |
5: | half(s(s(x))) | → s(half(x)) | |
6: | plus(0,y) | → y | |
7: | plus(s(x),y) | → s(plus(x,y)) | |
8: | times(0,y) | → 0 | |
9: | times(s(x),y) | → if_times(even(s(x)),s(x),y) | |
10: | if_times(true,s(x),y) | → plus(times(half(s(x)),y),times(half(s(x)),y)) | |
11: | if_times(false,s(x),y) | → plus(y,times(x,y)) | |
12: | EVEN(s(s(x))) | → EVEN(x) | |
13: | HALF(s(s(x))) | → HALF(x) | |
14: | PLUS(s(x),y) | → PLUS(x,y) | |
15: | TIMES(s(x),y) | → IF_TIMES(even(s(x)),s(x),y) | |
16: | TIMES(s(x),y) | → EVEN(s(x)) | |
17: | IF_TIMES(true,s(x),y) | → PLUS(times(half(s(x)),y),times(half(s(x)),y)) | |
18: | IF_TIMES(true,s(x),y) | → TIMES(half(s(x)),y) | |
19: | IF_TIMES(true,s(x),y) | → HALF(s(x)) | |
20: | IF_TIMES(false,s(x),y) | → PLUS(y,times(x,y)) | |
21: | IF_TIMES(false,s(x),y) | → TIMES(x,y) | |